<table width="100%" border="0" cellspacing="1" cellpadding="0" class="table table-bordered table-hover table-striped">
  <tr>
    <td width="15%" align="right">姓名</td>
    <td width="23%" align="center"><input type="text" name="name" value="<{$oneDetail.name}>"/></td>
    <td width="19%" align="right">性别</td>
    <td width="19%" align="center"><input type="radio" name="sex" id="boy" value="男"/>男<input id="girl" type="radio" name="sex" value="女"/>女</td>
    <td width="24%" rowspan="4" align="center"><iframe width="180" height="180" src="<{:U("Request/uploadPic")}>" frameborder="0" scrolling="no" id="pic"></iframe></td>
  </tr>
  <tr>
    <td align="right">籍贯</td>
    <td align="center"><input type="text" name="birthplace" value="<{$oneDetail.birthplace}>"/><br/><small style="color:red">(格式：安徽省淮南市田家庵区)</small/></td>
    <td align="right">民族</td>
    <td align="center"><input type="text" name="nation" value="<{$oneDetail.nation}>"/><br/><small style="color:red">(格式：汉族)</small/></td>
  </tr>
  <tr>
    <td align="right">生份证</td>
    <td align="center"><input type="text" name="idcard" value="<{$oneDetail.idcard}>"/></td>
    <td align="right">生源地</td>
    <td align="center"><input type="text" name="comefrom" value="<{$oneDetail.comefrom}>"/><br/><small style="color:red">(格式：安徽省淮南市田家庵区)</small/></td>
  </tr>
  <tr>
    <td align="right">个人电话</td>
    <td align="center"><input type="text" name="phone" value="<{$oneDetail.phone}>"/></td>
    <td align="right">QQ</td>
    <td align="center"><input type="text" name="zipcode" value="<{$oneDetail.zipcode}>"/></td>
  </tr>
  <tr style="height:80px;">
    <td align="right">联系地址</td>
    <td colspan="4" align="center"><textarea rows="2" style="width:90%" name="address"><{$oneDetail.address}></textarea></td>
  </tr>
  <tr>
    <td align="right">年级</td>
    <td colspan="2" align="center">
    	<select name="grade">
			<option>-----请选择-----</option>
		</select>
    </td>
    <td align="right">专业</td>
    <td align="center">
		<select name="major">
			<option>-----请选择-----</option>
		</select>
	</td>
  </tr>
  <tr>
    <td align="right">班级</td>
    <td colspan="2" align="center">
    	<select name="class">
			<option>-----请选择-----</option>
		</select>
    </td>
    <td align="right">学号</td>
    <td align="center"><input type="text" name="sid" value="<{$oneDetail.sid}>"/></td>
  </tr>
  <tr>
    <td align="right">政治面貌</td>
    <td colspan="4" align="center"><input type="radio" name="party" id="dy" value="1"/>党员<input id="qz" type="radio" name="party" value="0"/>群众<input type="radio" name="party" id="ty" value="2"/>团员</td>
  </tr>
  <tr style="height:80px;">
    <td align="right">个人特长</td>
    <td colspan="4" align="center"><textarea rows="2" style="width:90%" name="techang"><{$oneDetail.techang}></textarea></td>
  </tr>
  <tr>
    <td align="right">辅修第二专业</td>
    <td colspan="4" align="center"><input type="text" name="secondmajor" style="width:90%" value="<{$oneDetail.secondmajor}>"/><br/><small style="color:red">(请填写完整的辅修专业名称，若没有辅修，请不要填写)</small/></td>
  </tr>
</table>
<center>
<center><button style="margin-top:5px" class="btn btn-large btn-primary" name="createNewBase">提交信息</button></center>
</center>
<script>
	var isid1=document.getElementById("mychecksid");
	var pic=document.getElementById("pic");
	var createnew=new PureAjax();
	var grade1=document.getElementsByName("grade")[0];
	var major1=document.getElementsByName("major")[0];
	var iclass1=document.getElementsByName("class")[0];
	var submit1=document.getElementsByName("createNewBase")[0];
	var dy=document.getElementById("dy");
	var qz=document.getElementById("qz");
	var ty=document.getElementById("ty");
	var year1=(new Date()).getFullYear();
	var sex1="男";
	var j;
	var opt1;
	var isparty1="<{$oneDetail.isparty}>";
	var method1="<{$method|default='create'}>";
	(document.getElementsByName("sex")[0]).onclick=function(){sex1="男";};
	(document.getElementsByName("sex")[1]).onclick=function(){sex1="女";};
	var pic_sid=document.getElementsByName("sid")[0];
	var uploadURL=pic.src;
	if (pic_sid.value!="") {
		pic.src=uploadURL;
		pic.src+="?sid="+pic_sid.value;
	}else{

		pic_sid.onblur=function(){
			pic.src=uploadURL;
			pic.src+="?sid="+this.value;
		}
	}
	for(j=0;j<5;j++){
		opt1=document.createElement("option");
		opt1.value=year1-j;
		opt1.innerHTML=(year1-j)+"级";
		grade1.appendChild(opt1);
	}
	j=0;
	if("<{$oneDetail.isparty}>"=="1"){
		dy.checked=true;
	}
	if("<{$oneDetail.isparty}>"=="0"){
		qz.checked=true;
	}
	if("<{$oneDetail.isparty}>"=="2"){
		ty.checked=true;
	}
	dy.onclick=function(){
		isparty1=this.value
	}
	qz.onclick=function(){
		isparty1=this.value
	}
	ty.onclick=function(){
		isparty1=this.value
	}
	createnew.post({
		dataType:"json",
		data:{},
		url:URL+"Request/getMajorList",
		success:function(data){
			var length=data.length;
			for(j=0;j<length;j++){
				opt1=document.createElement("option");
				opt1.value=data[j].code;
				opt1.innerHTML=data[j].name;
				major1.appendChild(opt1);
			}
		}
	});
	j=0;
	major1.onchange=function(){
		createnew.post({
			dataType:"json",
			async:true,
			data:{getmajor:major1.value},
			url:URL+"Request/getClassList",
			success:function(data){
				var length=data.length;
				iclass1.innerHTML="";
				for(j=0;j<length;j++){
					opt1=document.createElement("option");
					opt1.value=data[j].code;
					opt1.innerHTML=data[j].name;
					iclass1.appendChild(opt1);
				}
			}
		});
	}
	if("<{$oneDetail.sex}>"=="男"){
		(document.getElementById("boy")).checked="true";
	}else{
		(document.getElementById("girl")).checked="true";
	}
	for(j=0;j<grade1.options.length;j++){
		if(grade1.options[j].value=="<{$oneDetail.grade}>"){
			grade1.options[j].selected=true;
		}
	}
	for(j=0;j<major1.options.length;j++){
		if(major1.options[j].value=="<{$oneDetail.major}>"){
			major1.options[j].selected=true;
			major1.onchange();
		}
	}
	for(j=0;j<iclass1.options.length;j++){
		if(iclass1.options[j].value=="<{$oneDetail.class}>"){
			iclass1.options[j].selected=true;
		}
	} 
	
	submit1.onclick=function(){
		isid1.value=(document.getElementsByName("sid")[0]).value;
		createnew.post({
			dataType:"text",
			async:true,
			data:{//创建需要提交的数据
				name:(document.getElementsByName("name")[0]).value,
				sex:sex1,
				birthplace:(document.getElementsByName("birthplace")[0]).value,
				nation:(document.getElementsByName("nation")[0]).value,
				idcard:(document.getElementsByName("idcard")[0]).value,
				comefrom:(document.getElementsByName("comefrom")[0]).value,
				phone:(document.getElementsByName("phone")[0]).value,
				zipcode:(document.getElementsByName("zipcode")[0]).value,
				address:(document.getElementsByName("address")[0]).value,
				grade:grade1.value,
				major:major1.value,
				iclass:iclass1.value,//该数据的字段iclass提交至服务器的时候需要修改为class
				sid:(document.getElementsByName("sid")[0]).value,
				isparty:isparty1,
				techang:(document.getElementsByName("techang")[0]).value,
				secondmajor:(document.getElementsByName("secondmajor")[0]).value,
				submit:"yes",
				method:method1
			},
			url:URL+"Editor/createNewBase",
			success:function(data){
				alert(data);
			}
		});
	}
</script>
